package algutil.parser;

import java.util.ArrayList;
import java.util.List;

public class TRTag {

	private String text;

	private List<TDTag> tds;

	public TRTag(String s) {
		text = s;
	}

	public void extractTD() {
		tds = new ArrayList<TDTag>();
		int pos = 0;
		while (pos != -1) {

			TDTag td = new TDTag(text.substring(text.indexOf(">", text.indexOf(
					"<td", pos)) + 1, text.indexOf("</td>", pos) != -1 ? text
					.indexOf("</td>", pos) : text.length()));
			// System.out.println(td);
			tds.add(td);

			pos = text.indexOf("<td", text.indexOf("<td", pos) + 1);

		}
	}

	public String toString() {
		return "  TR : " + text;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public List<TDTag> getTds() {
		return tds;
	}

	public void setTds(List<TDTag> tds) {
		this.tds = tds;
	}
}
